<?php 
/**
 *   This file is part of GeoArticle (a Joomla plugin).
 *   Written by Ivar Bergman (www.ivarbergman.se)
 *   Copyright (c) 2010 Ivar Bergman. All rights reserved.
 *
 *   GeoArticle is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   GeoArticle is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with GeoArticle.  If not, see <http://www.gnu.org/licenses/>.
 *
 */


defined('_JEXEC') or die('Restricted access'); 

$ts = "ts=".time();

jimport( 'joomla.environment.uri' );
$skin = $params->get("skin");
if (!$skin)
  {
    $skin = "default";
  }
$doc =& JFactory::getDocument();
$doc->addStyleSheet( "modules/mod_geoarticle/tmpl/map.css?$ts");
$doc->addStyleSheet( "modules/mod_geoarticle/tmpl/map_ctrl.css?$ts");
$doc->addStyleSheet( "modules/mod_geoarticle/tmpl/map_menu.css?$ts");
$doc->addStyleSheet( "modules/mod_geoarticle/tmpl/map_info_window.css?$ts");
$doc->addStyleSheet( "modules/mod_geoarticle/tmpl/skin/{$skin}/style.css?$ts");

$doc->addScript( "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" );
$doc->addScript( "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js" );
$doc->addScript( "http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=" . $params->get("key"));

$doc->addScript( "modules/mod_geoarticle/include/geoarticle.js?$ts" );
$doc->addScript( "modules/mod_geoarticle/include/labeled_marker.js?$ts" );
$doc->addScript( "modules/mod_geoarticle/include/markermanager.js?$ts" );
$doc->addScript( "modules/mod_geoarticle/include/geoarticle_model.js?$ts" );
$doc->addScript( "modules/mod_geoarticle/include/geoarticle_ui.js?$ts" );

$doc->addScript( "modules/mod_geoarticle/include/geoarticle_ui.js?$ts" );
$lang = substr($doc->language, 0, 2);
if (!$lang)
  {
    $lang = $params->get("language");
  }

$skinBase = JURI::base()."modules/mod_geoarticle/tmpl/skin/{$skin}";
$print = $_GET["print"] == 1 ? "1" : "0";

$GAConf = "var GAConf = 
  {
    divHookID: '#map',
    skin : '{$skin}',
    print : {$print},
    language : '{$lang}',
    lng : {$params->get("lng")},
    lat : {$params->get("lat")},
    zoom:  {$params->get("zoom")},
    width : {$params->get("width")},
    height : {$params->get("height")},
    maxZoom : 17,
    minZoom : 0,
    moduleBase: '{$base}modules/mod_geoarticle/',
    joomlaBase: '{$base}'
  };
";

$doc->addScriptDeclaration($GAConf);

 ?>

<div id="map">
      <div id='map_canvas'></div> 
      <div id='map_ctrl'> 
	<div class='map_pos'>
          <a class='up' href='#up'></a>
	  <a class='left' href='#left'></a>
	  <a class='center' href='#center'></a>
	  <a class='right' href='#right'></a>
	  <a class='down' href='#down'></a>
	</div>
	<div class='map_zoom'>
	  <a class='in' href='#in'></a>
	  <a class='out' href='#out'></a>
	  <div id='track'></div>
	</div>
      </div>
      <div id='map_type'>
	<a class='normal' href='#normal'><span>Map</span></a>
	<a class='satellite' href='#satellite'><span>Sat</span></a>
	<a class='physical' href='#physical'><span>Ter</span></a>
      </div>
      <div id='map_menu'>
       <div id='map_menu_bg'>
	<ul id='map_menu_list'>
	  <li class='header'>
	    <h2><span style='float:left;'>Aktiviteter</span><a id='print_map' class='print' rel='nofollow' title='Print' href='#' style='float:right;'><img style='float: right;' src='<?= $skinBase ?>/printButton.png'  alt='Print'/></a></h2>
	  </li>
	</ul>
	</div>
	<div id='map_menu_bottom'>
	</div>
      </div>
      <div id='map_info'>
	<div id='map_info_header'>
	  <div id='map_info_header_right'>
	  <a class='close' href='#close'></a>
<a id='print' class='print' rel='nofollow' title='Print' href=''><img style='float: right;' src='<?= $skinBase ?>/printButton.png'  alt='Print'/></a>
          </div>
	</div>
	<div id='map_info_body'>
  	  <iframe allowtransparency='true' frameborder='0' id='map_info_content'></iframe>
	</div>
      </div>
</div>


    